﻿using OperationPlugins.Validators;
using TimeProject.Engine.DbModels;
using TimeProject.Validators.Utils;

namespace TimeProject.Validators.DbModels.Level2
{
    [ValidatorOf(ValidationLevel.Level2, typeof(User))]
    public class UserValidator : TimeProjectValidatorBase<User>
    {
        protected override void Validate()
        {
            if (string.IsNullOrEmpty(Value.EMail) == false)
            {
                PassIfTrue(StringUtil.IsWellFormedEmail(Value.EMail), "Given e-mail address is not well-formed.");
            }
        }
    }
}
